@use 'utils/variables';

#SystemRolePermissions {
    margin-top: 0;
}

.SystemRolePermissions {
    padding: 2rem 2rem 2rem 2rem;
    background: #f5f5f5;
    color: rgba(var(--sys-center-channel-color-rgb), 0.87);

    .PermissionRow {
        &:nth-child(even) {
            background: rgba(255, 255, 255, 0.5);
        }

        .PermissionSection {
            display: flex;
            height: auto;
            flex-direction: row;

            .PermissionSectionText {
                display: flex;
                flex-direction: column;
                flex-grow: 3;
                align-content: flex-start;
                padding: 14px 16px;
                margin-top: 10px;

                .PermissionSectionText_title {
                    color: rgba(var(--sys-center-channel-color-rgb), 0.87);
                    font-size: 14px;
                    font-weight: 600;
                }

                .PermissionSectionText_description {
                    font-size: 12px;
                }
            }

            .PermissionSectionDropdown {
                padding: 0 16px;
                margin: auto;

                .Menu__content {
                    min-width: 256px;
                }

                .MenuWrapper {
                    box-sizing: border-box;
                    border-radius: 4px;
                    background: rgba(var(--sys-center-channel-color-rgb), 0.04);

                    .PermissionSectionDropdownButton {
                        display: flex;
                        width: 132px;
                        height: 32px;
                        box-sizing: border-box;
                        justify-content: space-between;
                        padding: 1px 0 1px 4px;
                        border: 1px solid rgba(var(--sys-center-channel-color-rgb), 0.16);
                        border-radius: 4px;
                        background: var(--sys-center-channel-bg);
                        color: var(--sys-center-channel-color);
                        font-size: 12px;
                        font-style: normal;
                        font-weight: normal;
                        line-height: 28px;

                        &:hover {
                            border: 1px solid rgba(var(--sys-center-channel-color-rgb), 0.48);
                        }

                        .PermissionSectionDropdownButton_text {
                            max-width: 230px;
                            flex-grow: 3;
                            padding-left: 8px;
                            overflow-x: hidden;
                            text-align: left;
                            text-overflow: ellipsis;
                        }

                        .PermissionSectionDropdownButton_more {
                            margin-right: 8px;
                            color: rgba(var(--sys-center-channel-color-rgb), 0.75);
                        }

                        .PermissionSectionDropdownButton_icon {
                            min-width: 32px;
                            height: 31px;
                            border-left: 1px solid rgba(var(--sys-center-channel-color-rgb), 0.16);
                            margin-top: -1px;

                            .Icon {
                                display: flex;
                                width: 14px;
                                height: 14px;
                                padding-top: 8px;
                                margin-right: 0;
                                margin-left: 6px;
                            }
                        }
                    }

                    &[disabled] {
                        opacity: 1;

                        .PermissionSectionDropdownButton {
                            border-color: rgba(var(--sys-center-channel-color-rgb), 0.16);
                            background: rgba(var(--sys-center-channel-color-rgb), 0.08);
                            color: var(--sys-center-channel-color);
                        }
                    }
                }

                .PermissionSectionDropdownOptions_description {
                    padding-bottom: 4px;
                    line-height: 16px;
                    white-space: normal;
                }
            }
        }

        .PermissionSubsectionsToggle {
            margin: 0;
            line-height: 16px;

            button {
                font-size: 12px;
            }
        }

        .PermissionSubsections {
            padding-left: 16px;
            border-left: 1px solid rgba(var(--sys-center-channel-color-rgb), 0.16);
            margin: 0 0 14px 16px;

            .PermissionSection {
                height: auto;
                padding: 4px 0;

                .PermissionSectionText {
                    .PermissionSectionText_title {
                        font-size: 12px;
                        font-weight: 400;
                    }

                    padding: 0;
                    margin: auto;
                }

                .PermissionSection_description {
                    span {
                        border-radius: 2px;
                        background: rgba(var(--sys-center-channel-color-rgb), 0.08);
                    }

                    margin: 0;
                    font-size: 10px;
                    font-weight: 600;
                    line-height: 15px;
                }

                .PermissionSectionDropdown {
                    padding: 0 16px;
                    margin: 0;
                }
            }

            .PermissionSection:last-of-type {
                padding-bottom: 0;
            }
        }
    }

    .PermissionSectionDropdownOptions {
        .PermissionSectionDropdownOptions_label {
            color: var(--sys-center-channel-color);
            font-size: 14px;
        }

        .PermissionSectionDropdownOptions_description {
            color: rgba(var(--sys-center-channel-color-rgb), 0.75);
            font-size: 12px;
        }
    }

    &List {
        margin-top: 12px;

        li:not(:last-child) {
            margin-bottom: 8px;
        }
    }
}
